package com.jevons.geo_edit.model;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Copyright 2020 JxGIS
 *
 * @file GisProperty
 * @auth linaisheng
 * Created on 2023/9/22.
 * Description：
 */
public class GisField implements Parcelable {

    private String id;
    private String layerId;
    private Integer sort;
    private String fieldName;
    private String fieldType;
    private String fieldNote;

    private Integer length;         //字段长度
    private Integer numericScale;   //小数位数
    private String notnull;         //非空 1-可为空；2-不可为空
    private String comment;         //备注
    private String columnDefault;   //默认值

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getLayerId() {
        return layerId;
    }

    public void setLayerId(String layerId) {
        this.layerId = layerId;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public String getFieldName() {
        return fieldName;
    }

    public void setFieldName(String fieldName) {
        this.fieldName = fieldName;
    }

    public String getFieldType() {
        return fieldType;
    }

    public void setFieldType(String fieldType) {
        this.fieldType = fieldType;
    }

    public String getFieldNote() {
        return fieldNote;
    }

    public void setFieldNote(String fieldNote) {
        this.fieldNote = fieldNote;
    }

    public Integer getLength() {
        return length;
    }

    public void setLength(Integer length) {
        this.length = length;
    }

    public Integer getNumericScale() {
        return numericScale;
    }

    public void setNumericScale(Integer numericScale) {
        this.numericScale = numericScale;
    }

    public String getNotnull() {
        return notnull;
    }

    public void setNotnull(String notnull) {
        this.notnull = notnull;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public String getColumnDefault() {
        return columnDefault;
    }

    public void setColumnDefault(String columnDefault) {
        this.columnDefault = columnDefault;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.id);
        dest.writeString(this.layerId);
        dest.writeValue(this.sort);
        dest.writeString(this.fieldName);
        dest.writeString(this.fieldType);
        dest.writeString(this.fieldNote);
        dest.writeValue(this.length);
        dest.writeValue(this.numericScale);
        dest.writeString(this.notnull);
        dest.writeString(this.comment);
        dest.writeString(this.columnDefault);
    }

    public void readFromParcel(Parcel source) {
        this.id = source.readString();
        this.layerId = source.readString();
        this.sort = (Integer) source.readValue(Integer.class.getClassLoader());
        this.fieldName = source.readString();
        this.fieldType = source.readString();
        this.fieldNote = source.readString();
        this.length = (Integer) source.readValue(Integer.class.getClassLoader());
        this.numericScale = (Integer) source.readValue(Integer.class.getClassLoader());
        this.notnull = source.readString();
        this.comment = source.readString();
        this.columnDefault = source.readString();
    }

    public GisField() {
    }

    public GisField(String id, String layerId, String fieldType) {
        this.id = id;
        this.layerId = layerId;
        this.fieldType = fieldType;
    }


    protected GisField(Parcel in) {
        this.id = in.readString();
        this.layerId = in.readString();
        this.sort = (Integer) in.readValue(Integer.class.getClassLoader());
        this.fieldName = in.readString();
        this.fieldType = in.readString();
        this.fieldNote = in.readString();
        this.length = (Integer) in.readValue(Integer.class.getClassLoader());
        this.numericScale = (Integer) in.readValue(Integer.class.getClassLoader());
        this.notnull = in.readString();
        this.comment = in.readString();
        this.columnDefault = in.readString();
    }

    public static final Creator<GisField> CREATOR = new Creator<GisField>() {
        @Override
        public GisField createFromParcel(Parcel source) {
            return new GisField(source);
        }

        @Override
        public GisField[] newArray(int size) {
            return new GisField[size];
        }
    };
}